package
{
    import adapterPattem.IDuck;
    import adapterPattem.MallardDuck;
    import adapterPattem.TurkeyAdapter;
    import adapterPattem.WildTurkey;

    import flash.display.Sprite;

    public class AdapterPatternMain extends Sprite
    {
        public function AdapterPatternMain()
        {
            var duck:MallardDuck = new MallardDuck();
            var turkey:WildTurkey = new WildTurkey();

            var turkeyAdapter:IDuck = new TurkeyAdapter(turkey);

            trace("n칠면조가 말함");
            turkey.gobble();
            turkey.fly();

            trace("n오리가 말함");
            testDuck(duck);

            trace("n칠면조 아탭터가 말함");
            testDuck(turkeyAdapter);
        }

        private function testDuck(duck:IDuck):void
        {
            duck.quack();
            duck.fly();
        }

    }
}